//
//  APPLEComposeMenuButton.swift
//  123
//
//  Created by pangjiaxing on 16/1/6.
//  Copyright © 2016年 pangjiaxing. All rights reserved.
//

import UIKit

class APPLEComposeMenuButton: UIButton {

    override var highlighted:Bool{
        set{

            }
        get{
                return false
            }
    }
    override init(frame: CGRect) {
        super.init(frame: frame)
        setUpUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
//    case ScaleToFill
//    case ScaleAspectFit // contents scaled to fit with fixed aspect. remainder is transparent
//    case ScaleAspectFill // contents scaled to fill with fixed aspect. some portion of content may be clipped.
//    case Redraw // redraw on bounds change (calls -setNeedsDisplay)
//    case Center // contents remain same size. positioned adjusted.
//    case Top
//    case Bottom
//    case Left
//    case Right
//    case TopLeft
//    case TopRight
//    case BottomLeft
//    case BottomRight
    
    private func setUpUI(){
        titleLabel?.font = UIFont.systemFontOfSize(16)
        setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
        titleLabel?.textAlignment = .Center
        imageView?.contentMode = .Center
    }
    override func layoutSubviews() {
        super.layoutSubviews()
        
        // 图片放在上面
        imageView?.frame.origin.x = 0
        imageView?.frame.origin.y = 0
        imageView?.frame.size = CGSize(width: frame.width, height: frame.width)
        
        // label 放在下面
        titleLabel?.frame.origin.x = 0
        titleLabel?.frame.origin.y = frame.width
        titleLabel?.frame.size = CGSize(width: frame.width, height: frame.height - frame.width)

        
    }

}
